#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<vector>
using namespace std;

union u {
	int d1;
	float d2;
}d;

string compressString(string S) {
    string ret;
    ret += S[0];
    int count = 1;
    for (int i = 1; i < S.size(); ++i)
    {
        if (S[i] == S[i - 1])
            ++count;
        else
        {
            ret += to_string(count);
            ret += S[i];
            count = 1;
        }
    }
    ret += to_string(count);
    return ret.size() >= S.size() ? S : ret;
}

int hammingWeight(int n) {
    int count = 0;
    for (int i = 0; i < 32; ++i)
    {
        int tmp = n;
        if (((tmp >> i) & 1) == 1)
            ++count;
    }
    return count;
}

vector<int> countBits(int n) {
    vector<int> ret;
    for (int j = 0; j <= n; ++j)
    {
        int cnt = 0;
        for (int i = 0; i < 32; ++i)
        {
            if (j & (1 << i)) ++cnt;
        }
        ret.push_back(cnt);
    }
    return ret;
}

int hammingDistance(int x, int y) {
    int n = x ^ y;
    int cnt = 0;
    for (int i = 0; i < 32; ++i)
    {
        if (n & (1 << i)) ++cnt;
    }
    return cnt;
}

vector<int> singleNumber(vector<int>& nums) {
    size_t n = 0;
    for (auto num : nums)
    {
        n ^= num;
    }
    int lsb = n & (-n);
    int x = 0, y = 0;
    for (auto num : nums)
    {
        if (lsb & num)
            x ^= num;
        else
            y ^= num;
    }
    return { x,y };
}

int exchangeBits(int num) {
    int even = num & 0xaaaaaaaa;
    int odd = num & 0x55555555;
    even >>= 1;
    odd <<= 1;
    num = even | odd;
    return num;
}

int main()
{
	/*d.d2 = 10;
	printf("%p\n", d);
	printf("%p\n", d.d1);
	printf("%p\n", d.d2);
	printf("%d\n", d);
	printf("%d\n", d.d1);
	printf("%f\n", d.d2);*/
	string s = "1";
}